2130c9defd03a15c9480c511a6da724d74f63db4,genie-web/src/test/java/com/netflix/genie/web/controllers/CommandRestControllerIntegrationTests.java,CommandRestControllerIntegrationTests,canFindCommands,#,184
Before Change
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.content().contentType(MediaTypes.HAL_JSON))
.andExpect(MockMvcResultMatchers.jsonPath(COMMANDS_LIST_PATH, Matchers.hasSize(1)))
.andExpect(MockMvcResultMatchers.jsonPath(COMMANDS_LIST_PATH + "[0].id", Matchers.is(id2)));
// Query by user
this.mvc
After Change
null
);
final RestDocumentationResultHandler findResultHandler = MockMvcRestDocumentation.document(
"{class-name}/{method-name}/{step}/",
Preprocessors.preprocessRequest(Preprocessors.prettyPrint()),
Preprocessors.preprocessResponse(Preprocessors.prettyPrint()),
Snippets.COMMAND_SEARCH_QUERY_PARAMETERS, // Request query parameters
Snippets.HAL_CONTENT_TYPE_HEADER, // Response headers
Snippets.COMMAND_SEARCH_RESULT_FIELDS, // Result fields
Snippets.SEARCH_LINKS // HAL Links
);
// Test finding all commands
this.mvc
.perform(MockMvcRequestBuilders.get(COMMANDS_API))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.content().contentType(MediaTypes.HAL_JSON))
.andExpect(MockMvcResultMatchers.jsonPath(COMMANDS_LIST_PATH, Matchers.hasSize(3)))
.andDo(findResultHandler);
// Try to limit the number of results
this.mvc
.perform(MockMvcRequestBuilders.get(COMMANDS_API).param("size", "2"))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.content().contentType(MediaTypes.HAL_JSON))
.andExpect(MockMvcResultMatchers.jsonPath(COMMANDS_LIST_PATH, Matchers.hasSize(2)))
.andDo(findResultHandler);
// Query by name
this.mvc
.perform(MockMvcRequestBuilders.get(COMMANDS_API).param("name", name2))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.content().contentType(MediaTypes.HAL_JSON))
.andExpect(MockMvcResultMatchers.jsonPath(COMMANDS_LIST_PATH, Matchers.hasSize(1)))
.andExpect(MockMvcResultMatchers.jsonPath(COMMANDS_LIST_PATH + "[0].id", Matchers.is(id2)))
.andDo(findResultHandler);
// Query by user
this.mvc